Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add dc store binding polyfill and migrate http2 #3284

Merged
merged 3 commits into from
Jul 5, 2023
Merged

Conversation

rochdev
Copy link
Member

@rochdev rochdev commented Jun 22, 2023

What does this PR do?

Add diagnostics channel store binding polyfill and migrate http2.

Motivation

Using AsyncResource for scoping can be problematic when resources are nested. Using runStores and bindStore instead handles nesting properly and is also the official way to do this using built-ins.

@github-actions
Copy link

github-actions bot commented Jun 22, 2023

Overall package size

Self size: 4.74 MB
Deduped: 61.21 MB
No deduping: 61.25 MB

Dependency sizes

name version self size total size
@datadog/pprof 2.2.3 14.25 MB 15.13 MB
@datadog/native-iast-taint-tracking 1.5.0 14.86 MB 14.86 MB
@datadog/native-appsec 3.2.0 13.38 MB 13.39 MB
protobufjs 7.1.2 2.76 MB 6.55 MB
@datadog/native-iast-rewriter 2.0.1 2.09 MB 2.1 MB
@opentelemetry/core 1.14.0 872.87 kB 1.47 MB
@datadog/native-metrics 2.0.0 898.77 kB 1.3 MB
@opentelemetry/api 1.4.1 780.32 kB 780.32 kB
opentracing 0.14.7 194.81 kB 194.81 kB
semver 7.5.3 93.39 kB 123.79 kB
@datadog/sketches-js 2.1.0 109.9 kB 109.9 kB
lodash.sortby 4.7.0 75.76 kB 75.76 kB
lru-cache 7.14.0 74.95 kB 74.95 kB
ipaddr.js 2.0.1 59.52 kB 59.52 kB
ignore 5.2.0 48.87 kB 48.87 kB
import-in-the-middle 1.3.5 34.34 kB 38.81 kB
istanbul-lib-coverage 3.2.0 29.34 kB 29.34 kB
retry 0.10.1 27.44 kB 27.44 kB
lodash.uniq 4.5.0 25.01 kB 25.01 kB
limiter 1.1.5 23.17 kB 23.17 kB
lodash.kebabcase 4.1.1 17.75 kB 17.75 kB
lodash.pick 4.4.0 16.33 kB 16.33 kB
node-abort-controller 3.0.1 14.33 kB 14.33 kB
crypto-randomuuid 1.0.0 11.18 kB 11.18 kB
diagnostics_channel 1.1.0 7.07 kB 7.07 kB
path-to-regexp 0.1.7 6.78 kB 6.78 kB
koalas 1.0.2 6.47 kB 6.47 kB
methods 1.1.2 5.29 kB 5.29 kB
module-details-from-path 1.0.3 4.47 kB 4.47 kB

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@codecov
Copy link

codecov bot commented Jun 22, 2023

Codecov Report

Merging #3284 (67debdb) into master (6810871) will decrease coverage by 0.10%.
The diff coverage is 50.00%.

@@            Coverage Diff             @@
##           master    #3284      +/-   ##
==========================================
- Coverage   86.04%   85.94%   -0.10%     
==========================================
  Files         200      200              
  Lines        7787     7806      +19     
  Branches       33       33              
==========================================
+ Hits         6700     6709       +9     
- Misses       1087     1097      +10     
Impacted Files Coverage Δ
packages/dd-trace/src/plugins/outbound.js 46.42% <0.00%> (-1.72%) ⬇️
packages/dd-trace/src/plugins/plugin.js 65.11% <30.00%> (-10.65%) ⬇️
packages/dd-trace/src/plugins/tracing.js 57.77% <68.75%> (+3.72%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@pr-commenter
Copy link

pr-commenter bot commented Jun 22, 2023

Benchmarks

Comparing candidate commit 67debdb in PR branch run-stores with baseline commit 6810871 in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 459 metrics, 33 unstable metrics.

Qard
Qard previously approved these changes Jun 22, 2023
tlhunter
tlhunter previously approved these changes Jun 22, 2023
@tlhunter tlhunter dismissed stale reviews from Qard and themself via b293353 June 26, 2023 20:14
@tlhunter
Copy link
Member

I haven't been able to figure out why this is now failing. This PR probably conflicts with #3261 after rebasing. The _computePeerService field on the tracer isn't truthy and getPeerService isn't able to pull out the necessary tags. Here's the error itself:

     AssertionError: expected { '_dd.p.dm': '-1', …(11) } to have property 'peer.service'

Which fails within the withPeerService call in packages/datadog-plugin-http2/test/client.spec.js.

@jbertran
Copy link
Contributor

jbertran commented Jul 3, 2023

The issue with peer.service is we're relying on in OutboundPlugin:finish to be called to make the peer service computation. This used to be the case because we only had start/error/finish - since we move http2 to not call finish, we don't get peer service.

I see 2 options for restoring it

  1. include the peer service logic in the new span closing hooks (for example in _onClose in http2, or provide default implementation for _onClose in plugin override it in outbound, ...)
  2. move the peer service logic to the span's finish method - we don't rely on the plugin's state except for precursors. We lose the automatic filtering provided by setting the logic in OutboundPlugin, but it can be replaced by filtering spans based on kind (peer service wants only producer/client spans).

@tlhunter tlhunter marked this pull request as ready for review July 5, 2023 17:07
@tlhunter tlhunter requested a review from a team as a code owner July 5, 2023 17:07
@tlhunter tlhunter merged commit ebbcd49 into master Jul 5, 2023
@tlhunter tlhunter deleted the run-stores branch July 5, 2023 17:11
Qard pushed a commit that referenced this pull request Jul 11, 2023
* add dc store binding polyfill and migrate http2

* fix error handling for synchronous exceptions

* OutboundPlugin#tagPeerService()

---------

Co-authored-by: Thomas Hunter II <tlhunter@datadog.com>
Qard pushed a commit that referenced this pull request Jul 11, 2023
* add dc store binding polyfill and migrate http2

* fix error handling for synchronous exceptions

* OutboundPlugin#tagPeerService()

---------

Co-authored-by: Thomas Hunter II <tlhunter@datadog.com>
Qard pushed a commit that referenced this pull request Jul 11, 2023
* add dc store binding polyfill and migrate http2

* fix error handling for synchronous exceptions

* OutboundPlugin#tagPeerService()

---------

Co-authored-by: Thomas Hunter II <tlhunter@datadog.com>
This was referenced Jul 11, 2023
Qard pushed a commit that referenced this pull request Jul 14, 2023
* add dc store binding polyfill and migrate http2

* fix error handling for synchronous exceptions

* OutboundPlugin#tagPeerService()

---------

Co-authored-by: Thomas Hunter II <tlhunter@datadog.com>
Qard pushed a commit that referenced this pull request Jul 14, 2023
* add dc store binding polyfill and migrate http2

* fix error handling for synchronous exceptions

* OutboundPlugin#tagPeerService()

---------

Co-authored-by: Thomas Hunter II <tlhunter@datadog.com>
Qard pushed a commit that referenced this pull request Jul 14, 2023
* add dc store binding polyfill and migrate http2

* fix error handling for synchronous exceptions

* OutboundPlugin#tagPeerService()

---------

Co-authored-by: Thomas Hunter II <tlhunter@datadog.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants